package entity

import (
	"shqsoft.cn/pasnj/base"

	"github.com/jinzhu/gorm"
)

//PHSJSHDR 短贷宝导入
type PHSJSHDR struct {
	ID     int     `gorm:"AUTO_INCREMENT;primary_key;column:ID"`
	KHYF   int     `gorm:"column:KHYF"`
	JJH    string  `gorm:"column:JJH"`
	KHMC   string  `gorm:"column:KHMC"`
	YWPZ   string  `gorm:"column:YWPZ"`
	RJ     float64 `gorm:"column:RJ"`
	ZXYL   float64 `gorm:"column:ZXYL"`
	ZXNL   float64 `gorm:"column:ZXNL"`
	SFSP   float64 `gorm:"column:SFSP"`
	TJR1   string  `gorm:"column:TJR1"`
	TJRBM1 string  `gorm:"column:TJRBM1"`
	ZB1    float64 `gorm:"column:ZB1"`
	TJR2   string  `gorm:"column:TJR2"`
	TJRBM2 string  `gorm:"column:TJRBM2"`
	ZB2    float64 `gorm:"column:ZB2"`
	TJR3   string  `gorm:"column:TJR3"`
	TJRBM3 string  `gorm:"column:TJRBM3"`
	ZB3    float64 `gorm:"column:ZB3"`
	DRJG   string  `gorm:"column:DRJG"`
}

//TableName 短贷宝导入
func (PHSJSHDR) TableName() string {
	return "T_BASE_YXFY_PHSJSH_DTIP"
}

//PHSJSHDRAfterImport 导入后执行分户处理
func PHSJSHDRAfterImport(tx *gorm.DB, params map[string]string) (err error) {
	prams := make([]interface{}, 1)
	prams[0] = params["KHYF"]
	tx.Exec("EXEC UP_BASE_YXFY_PHSJSH_DTIP ?", prams...)
	return nil
}

//PHSJSHDREF 返回结构体
func PHSJSHDREF() base.EntityFunc {
	return func() interface{} {
		entity := PHSJSHDR{}
		return &entity
	}
}

//PHSJSHDRESF 返回结构体数组
func PHSJSHDRESF() base.EntitiesFunc {
	return func() interface{} {
		var entities []PHSJSHDR
		return &entities
	}
}

func init() {
	base.DaoPoolObj.Put("PHSJSHDR", base.NewDefaultDao(PHSJSHDREF(), PHSJSHDRESF(), nil))
	base.SetAfterCallBack("PHSJSHDR", PHSJSHDRAfterImport)
}
